#ifndef NET_CONTEXT_POOL_HPP
#define NET_CONTEXT_POOL_HPP


#include <list>
#include <vector>
#include <memory>
#include "beast.hpp"
#include "net.hpp"

namespace TWT {
namespace NETWORK {

/// A pool of io_context objects.
class NetContextPool
{
public:
  /// Construct the io_context pool.
  explicit NetContextPool(std::size_t poolSize = 2);
  ~NetContextPool();

  /// Stop all io_context objects in the pool.
  void stop();
  net::io_context& getIoContext();

private:

   std::vector<std::thread> threads_;
   net::io_context ioContext_;
   net::any_io_executor work_;
};

} // NETWORK
} // twt

#endif // NET_CONTEXT_POOL_HPP
